﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:localButtons="clr-namespace:SLControlLibrary.Resources.Controls.Calendar.Buttons">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SLControlLibrary;component/Resources.Styles/ButtonStyles_StaticResources.xaml" />
    </ResourceDictionary.MergedDictionaries>
    
    <!-- Calendar Button -->
    <Style x:Key="CalendarButtonStyle" TargetType="localButtons:ucCalendarButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localButtons:ucCalendarButton">
                    <Grid
                        Height="{TemplateBinding Height}"
                        Width="{TemplateBinding Width}" 
                        Background="{TemplateBinding Background}"
                        HorizontalAlignment="Left"
                        Cursor="Hand">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="MouseOver">
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed" />
                                <vsm:VisualState x:Name="Disabled" />
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="FocusStates">
                                <vsm:VisualState x:Name="Focused" />
                                <vsm:VisualState x:Name="Unfocused" />
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <ContentPresenter
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Content="{TemplateBinding ButtonContent}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Guide Button -->
    <Style TargetType="localButtons:ucGuideButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localButtons:ucGuideButton">
                    <Grid>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Fill">
                                            <ObjectAnimationUsingKeyFrames.KeyFrames>
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource brushGuideHover}">
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames.KeyFrames>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGradient" Storyboard.TargetProperty="Fill">
                                            <ObjectAnimationUsingKeyFrames.KeyFrames>
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource brushGuideSelected}">
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames.KeyFrames>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Normal" />
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background" Background="White" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Grid Margin="1" Background="{TemplateBinding Background}">
                                <Border x:Name="BackgroundAnimation" Opacity="0" Background="#FF448DCA"/>
                                <Rectangle x:Name="BackgroundGradient" Fill="{StaticResource brushGuideNormal}" />
                            </Grid>
                        </Border>

                        <TextBlock
                            Text="{TemplateBinding ButtonText}"
                            TextAlignment="Center"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
